// Put_pkg/pages/Put_pkg/index.js
import Toast from '@vant/weapp/toast/toast';
Page({
  data: {
    maxLimit: 50,
    currentDate: '12:00',
    minHour: 13,
    maxHour: 14,
    charCount: 0,
    dateLayerVisible: false,
    visitDate:'',
    appointment:'2022.05.04 13:00',
    description: '', // 问题描述
  },
  openDateLayer(){
     this.setData({dateLayerVisible: true,})
  },
  onInput(e) {
    console.log(e);
    this.setData({
      visitDate:' 2022.05.04 '+ '   ' + e.detail,
      dateLayerVisible: false,
    });
  },
  closeDateLayer() { this.setData({ dateLayerVisible: false }) },
  delivery(e){
    console.log(e);
    Toast({
      message: '提交成功',
      position:'bottom',
      onClose: () => {
      // console.log('执行OnClose函数');
      wx.navigateBack({ delta: 1})
      }
    })
  },
  handleInput(event) {
    console.log(event);
    const value = event.detail.value;
    const inputLength = value.length;
    console.log(inputLength);
      if (inputLength > this.data.maxLimit) {
        this.setData({
          charCount: 50
        });
        // wx.showToast({
        //   title: '已达到最大字符数',
        //   icon: 'none'
        // });
      } else {
        this.setData({
          charCount: inputLength
        });
      }
  },
   closeDateLayer() {
    this.setData({ dateLayerVisible: false })
  },
})